package drds.binlog.server;

import drds.binlog.common.Authors;
import drds.binlog.common.position.ClientInfo;
import drds.common.Author;

import java.util.concurrent.TimeUnit;

@Author(name = Authors.LI_YANG)
public interface IService
{

    void subscribe(ClientInfo clientInfo);

    void unsubscribe(ClientInfo clientInfo);

    //
    Message getWithAutoAck(ClientInfo clientInfo, int batchSize);

    Message getWithAutoAck(ClientInfo clientInfo, int batchSize, Long timeout, TimeUnit timeUnit);

    //
    Message getWithoutAck(ClientInfo clientInfo, int batchSize);

    Message getWithoutAck(ClientInfo clientInfo, int batchSize, Long timeout, TimeUnit timeUnit);

    //
    void ack(ClientInfo clientInfo, long batchId);

    //
    void rollback(ClientInfo clientInfo);

    void rollback(ClientInfo clientInfo, Long batchId);
}
